<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:insert="~{include :: header('专集列表')}" />
    <th:block th:insert="~{include :: bootstrap-table-css}" />
</head>
<body class="hold-transition">
<div class="container-fluid mb-2">
    <div class="row">
        <div class="toolbar" id="toolbar" role="group">
            <a class="btn btn-success" onclick="addAlbum();" shiro:hasPermission="album:add">
                <i class="fa fa-plus"></i> 添加
            </a>
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table" class="table-striped"></table>
        </div>
    </div>
</div>
<th:block th:insert="~{include :: footer}" />
<th:block th:insert="~{include :: bootstrap-table-js}" />
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('course:album:edit')}]];
    var removeFlag = [[${@permission.hasPermi('course:album:remove')}]];
    var prefix = "/course/album";
    $(function() {
        var options = {
            url: prefix + "/list.json",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove.json",
            modalName: "专集",
            showPageGo: true,
            columns: [
                {
                    field: 'id',
                    align: 'center',
                    title: 'ID'
                },
                {
                    field: 'name',
                    title: '专集名称'
                },
                {
                    field: 'link',
                    title: '跳转'
                },
                {
                    field: 'courseNum',
                    align: 'center',
                    title: '课程数'
                },
                {
                    field: 'description',
                    title: '描述'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\', \'800px\', \'500px\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });

    function addAlbum() {
        $.modal.open("添加专集", prefix + "/add.html", '800px', '500px');
    }
</script>
</body>
</html>